package net.zjitc.array;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/3/29 10:48
 */
public class UserTest {
    static Scanner scannerInt=new Scanner(System.in);
    static Scanner scannerString=new Scanner(System.in);
    static UserDao userDao=new UserDaoList();
    public static void main(String[] args) {
        System.out.println("------欢迎光临------");
        System.out.println("1、注册");
        System.out.println("2、登录");
        System.out.println("3、退出");
        System.out.println("请输入你的选择：");
        int choose=scannerInt.nextInt();
        switch (choose){
            case 1:
                registUr();
                break;
            case 2:
                loginUr();
                break;
            case 3:
                System.out.println("欢迎下次光临！");
                System.exit(0);
                default:
                System.out.println("输入有误！");
                break;
        }
    }

    private static void registUr() {
        System.out.println("------注册界面------");
        System.out.println("请输入用户名:");
        String name=scannerString.nextLine();
        System.out.println("请输入密码：");
        String password=scannerString.nextLine();
        User user=new User(name,password);
        userDao.regist(user);
    }

    private static void loginUr() {
        System.out.println("------登录界面------");
        System.out.println("请输入用户名:");
        String name=scannerString.nextLine();
        System.out.println("请输入密码：");
        String password=scannerString.nextLine();
        userDao.login(name,password);
    }
}
